//
//  ALPS_BaseViewController.m
//  Alps
//
//  Created by dllo on 16/6/6.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ALPS_BaseViewController.h"
#import "UIButton+NMCategory.h"
#import "ALPS_PlayerMainViewController.h"
#import "ALPS_CollectViewController.h"

@interface ALPS_BaseViewController ()
@end

@implementation ALPS_BaseViewController
- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)setLeftBackButton
{
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"btn_back_n"] imageWithRenderingMode:1] style:UIBarButtonItemStylePlain target:self action:@selector(didClickedLeftButton:)];
}

//搜索按钮
- (void)setRightSearchButton:(SEL)search
{
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"icon_search_n"] imageWithRenderingMode:1] style:UIBarButtonItemStylePlain target:self action:search];
}

- (void)didClickedLeftButton:(UIBarButtonItem *)button
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)defaultCenterPushCollectVC
{
#warning (2)通知第二步:为想接收名字为"村口大喇叭"的通知中心所发送的信息的视图控制器添加注册(注册成为该村村民,能听到大喇叭信息了)
    //为当前视图控制器添加注册通知中心
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notificationAction:) name:@"推出收藏夹" object:nil];
}
#warning (3)通知第三步:接收到通知的时候触发的方法:(在这里能得到船体过来的对象!!--> notification.obcject)
- (void)notificationAction:(NSNotification *)notification
{
    ALPS_CollectViewController *collectVc = [[ALPS_CollectViewController alloc] init];
    [self.navigationController pushViewController:collectVc animated:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark -- 创建悬浮窗
- (void)createSkyWindow
{
    UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(5, 100,60, 60)];
    btn.backgroundColor = [UIColor redColor];
    btn.tag = 0;
    btn.layer.cornerRadius = 25;
    [btn setDragEnable:YES];
    [btn setAdsorbEnable:YES];
    [self.view addSubview:btn];
    [btn addTarget:self action:@selector(playerButtonDidClicked) forControlEvents:UIControlEventTouchUpInside];
}

- (void)asdghkagsfljaklf:(UIView *)backview
{
    UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(5, 100,60, 60)];
    btn.backgroundColor = [UIColor redColor];
    btn.tag = 0;
    btn.layer.cornerRadius = 25;
    [btn setDragEnable:YES];
    [btn setAdsorbEnable:YES];
    [backview addSubview:btn];
    [btn addTarget:self action:@selector(playerButtonDidClicked) forControlEvents:UIControlEventTouchUpInside];
}



- (void)playerButtonDidClicked
{
    NSLog(@"进入播放界面");
}


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
